<?php
	header('content-type:text/html;charset=utf-8');
class CacheAction extends Action {
	public function index(){
		if (!isset($_SESSION['uid']))
			$this->redirect('index/index');
		else{
			$this->assign('cache',array(
			'后台管理'=>array("Cache"=>"./Admin/Runtime/Cache","Temp"=>"./Admin/Runtime/Temp","Logs"=>"./Admin/Runtime/Logs","Data"=>"./Admin/Runtime/Data"),
			'前台管理'=>array("Cache"=>"./Home/Runtime/Cache","Temp"=>"./Home/Runtime/Temp","Logs"=>"./Home/Runtime/Logs","Data"=>"./Home/Runtime/Data")
			));
			$this->display();
		}
	}
	
	public function delete(){
		if (!isset($_SESSION['uid']))
			$this->redirect('index/index');
		else{

			if($this->isPost()){
				$arr=$_POST;
				
				$arr=$arr['menubox'];
				foreach($arr as $dir){
					if (is_dir($dir)) {
						$handle=opendir($dir);
						
						while(($file=readdir($handle))!=false){
							if (is_file($dir.'/'.$file)) {
								unlink($dir.'/'.$file) or die('sb');
								
							}
						}
						closedir($handle);
					}else{
						echo '目录不存在';
					}
				}
				
				$this->success('ok');
			}
		}
	}
}
?>